package com.xiaochong.tir.trades.rabbit;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * Created by admin on 2018/6/16.
 */
@Configuration
@Component
public class KucoinQueenConfig {
    @Bean
    public DirectExchange KucoinNodeAPIExchange() {
        return new DirectExchange(ExchangeQueue.Exchange.EX_NODE_API_MQ, true, false);
    }

    @Bean
    public Queue queueTradesKucoinBtcAction(){
        return new Queue(KucoinMqQueue.QUEUE_TRADES_KUCOIN_BTC, true);
    }
    @Bean
    public Binding bindingTradesKucoinBtcAction(){
        return BindingBuilder.bind(queueTradesKucoinBtcAction()).to(KucoinNodeAPIExchange()).with(KucoinMqQueue.QUEUE_TRADES_KUCOIN_BTC);
    }

    @Bean
    public Queue queueTradesKucoinNeoAction(){
        return new Queue(KucoinMqQueue.QUEUE_TRADES_KUCOIN_NEO, true);
    }
    @Bean
    public Binding bindingTradesKucoinNeoAction(){
        return BindingBuilder.bind(queueTradesKucoinNeoAction()).to(KucoinNodeAPIExchange()).with(KucoinMqQueue.QUEUE_TRADES_KUCOIN_NEO);
    }


    @Bean
    public Queue queueTradesKucoinUsdtAction(){
        return new Queue(KucoinMqQueue.QUEUE_TRADES_KUCOIN_USDT, true);
    }
    @Bean
    public Binding bindingTradesKucoinUsdtAction(){
        return BindingBuilder.bind(queueTradesKucoinUsdtAction()).to(KucoinNodeAPIExchange()).with(KucoinMqQueue.QUEUE_TRADES_KUCOIN_USDT);
    }

    @Bean
    public Queue queueTradesKucoinEthAction(){
        return new Queue(KucoinMqQueue.QUEUE_TRADES_KUCOIN_ETH, true);
    }
    @Bean
    public Binding bindingTradesKucoinEthAction(){
        return BindingBuilder.bind(queueTradesKucoinEthAction()).to(KucoinNodeAPIExchange()).with(KucoinMqQueue.QUEUE_TRADES_KUCOIN_ETH);
    }
    @Bean
    public Queue queueTradesKucoinKcsAction(){
        return new Queue(KucoinMqQueue.QUEUE_TRADES_KUCOIN_KCS, true);
    }
    @Bean
    public Binding bindingTradesKucoinKcsAction(){
        return BindingBuilder.bind(queueTradesKucoinKcsAction()).to(KucoinNodeAPIExchange()).with(KucoinMqQueue.QUEUE_TRADES_KUCOIN_KCS);
    }
}
